import Taro, { Component } from '@tarojs/taro'
import { AtSearchBar } from 'taro-ui'


class Header extends Taro.Component {
  constructor() {
    super(...arguments)
    this.state = {
      value: ''
    }
  }
  onChange(value) {
    this.setState({
      value: value
    })
  }
  onActionClick() {
    Taro.navigateTo({
      url: `/pages/search-prod-show/index?prodName=${this.state.value}`
    })
  }
  render() {
    return (
      <AtSearchBar
        fixed
        value={this.state.value}
        onChange={this.onChange.bind(this)}
        onActionClick={this.onActionClick.bind(this)}
      />
    )
  }
}
export default Header